3.11.81 \(\int \frac {(c+d \tan (e+f x))^3}{(a+i a \tan (e+f x))^2} \, dx\) [1081]

Optimal. Leaf size=136 \[ \frac {\left (c^3-3 i c^2 d-3 c d^2-3 i d^3\right ) x}{4 a^2}+\frac {d^3 \log (\cos (e+f x))}{a^2 f}+\frac {(c+i d)^2 (i c+3 d)}{4 a^2 f (1+i \tan (e+f x))}+\frac {(i c-d) (c+d \tan (e+f x))^2}{4 f (a+i a \tan (e+f x))^2} \]

[Out]

1/4*(c^3-3*I*c^2*d-3*c*d^2-3*I*d^3)*x/a^2+d^3*ln(cos(f*x+e))/a^2/f+1/4*(c+I*d)^2*(I*c+3*d)/a^2/f/(1+I*tan(f*x+
e))+1/4*(I*c-d)*(c+d*tan(f*x+e))^2/f/(a+I*a*tan(f*x+e))^2

________________________________________________________________________________________

Rubi [A]
time = 0.21, antiderivative size = 136, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 28, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.179, Rules used = {3639, 3670, 3556, 3607, 8} \begin {gather*} \frac {x \left (c^3-3 i c^2 d-3 c d^2-3 i d^3\right )}{4 a^2}+\frac {(c+i d)^2 (3 d+i c)}{4 a^2 f (1+i \tan (e+f x))}+\frac {d^3 \log (\cos (e+f x))}{a^2 f}+\frac {(-d+i c) (c+d \tan (e+f x))^2}{4 f (a+i a \tan (e+f x))^2} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(c + d*Tan[e + f*x])^3/(a + I*a*Tan[e + f*x])^2,x]

[Out]

((c^3 - (3*I)*c^2*d - 3*c*d^2 - (3*I)*d^3)*x)/(4*a^2) + (d^3*Log[Cos[e + f*x]])/(a^2*f) + ((c + I*d)^2*(I*c +
3*d))/(4*a^2*f*(1 + I*Tan[e + f*x])) + ((I*c - d)*(c + d*Tan[e + f*x])^2)/(4*f*(a + I*a*Tan[e + f*x])^2)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3607

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(-(
b*c - a*d))*((a + b*Tan[e + f*x])^m/(2*a*f*m)), x] + Dist[(b*c + a*d)/(2*a*b), Int[(a + b*Tan[e + f*x])^(m + 1
), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && LtQ[m, 0]

Rule 3639

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Sim
p[(-(b*c - a*d))*(a + b*Tan[e + f*x])^m*((c + d*Tan[e + f*x])^(n - 1)/(2*a*f*m)), x] + Dist[1/(2*a^2*m), Int[(
a + b*Tan[e + f*x])^(m + 1)*(c + d*Tan[e + f*x])^(n - 2)*Simp[c*(a*c*m + b*d*(n - 1)) - d*(b*c*m + a*d*(n - 1)
) - d*(b*d*(m - n + 1) - a*c*(m + n - 1))*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c
- a*d, 0] && EqQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0] && LtQ[m, 0] && GtQ[n, 1] && (IntegerQ[m] || IntegersQ[2*m
, 2*n])

Rule 3670

Int[(((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]))/((a_.) + (b_.)*tan[(e_.)
 + (f_.)*(x_)]), x_Symbol] :> Dist[B*(d/b), Int[Tan[e + f*x], x], x] + Dist[1/b, Int[Simp[A*b*c + (A*b*d + B*(
b*c - a*d))*Tan[e + f*x], x]/(a + b*Tan[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a
*d, 0]

Rubi steps

\begin {align*} \int \frac {(c+d \tan (e+f x))^3}{(a+i a \tan (e+f x))^2} \, dx &=\frac {(i c-d) (c+d \tan (e+f x))^2}{4 f (a+i a \tan (e+f x))^2}-\frac {\int \frac {(c+d \tan (e+f x)) \left (-2 a \left (c^2-2 i c d+d^2\right )+4 i a d^2 \tan (e+f x)\right )}{a+i a \tan (e+f x)} \, dx}{4 a^2}\\ &=\frac {(i c-d) (c+d \tan (e+f x))^2}{4 f (a+i a \tan (e+f x))^2}+\frac {i \int \frac {-2 a^2 c \left (2 c d+i \left (c^2+d^2\right )\right )-2 a^2 d \left (i c^2+4 c d+3 i d^2\right ) \tan (e+f x)}{a+i a \tan (e+f x)} \, dx}{4 a^3}-\frac {d^3 \int \tan (e+f x) \, dx}{a^2}\\ &=\frac {d^3 \log (\cos (e+f x))}{a^2 f}+\frac {(c+i d)^2 (i c+3 d)}{4 f \left (a^2+i a^2 \tan (e+f x)\right )}+\frac {(i c-d) (c+d \tan (e+f x))^2}{4 f (a+i a \tan (e+f x))^2}+\frac {\left (c^3-3 i c^2 d-3 c d^2-3 i d^3\right ) \int 1 \, dx}{4 a^2}\\ &=\frac {\left (c^3-3 i c^2 d-3 c d^2-3 i d^3\right ) x}{4 a^2}+\frac {d^3 \log (\cos (e+f x))}{a^2 f}+\frac {(c+i d)^2 (i c+3 d)}{4 f \left (a^2+i a^2 \tan (e+f x)\right )}+\frac {(i c-d) (c+d \tan (e+f x))^2}{4 f (a+i a \tan (e+f x))^2}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(305\) vs. \(2(136)=272\).
time = 2.03, size = 305, normalized size = 2.24 \begin {gather*} -\frac {\sec ^2(e+f x) \left (4 i c^3+12 i c d^2-8 d^3+\cos (2 (e+f x)) \left (3 c^2 d (-1-4 i f x)+d^3 (1+4 i f x)+c^3 (i+4 f x)-3 c d^2 (i+4 f x)+8 d^3 \log \left (\cos ^2(e+f x)\right )\right )+c^3 \sin (2 (e+f x))+3 i c^2 d \sin (2 (e+f x))-3 c d^2 \sin (2 (e+f x))-i d^3 \sin (2 (e+f x))+4 i c^3 f x \sin (2 (e+f x))+12 c^2 d f x \sin (2 (e+f x))-12 i c d^2 f x \sin (2 (e+f x))-4 d^3 f x \sin (2 (e+f x))+8 i d^3 \log \left (\cos ^2(e+f x)\right ) \sin (2 (e+f x))+16 d^3 \text {ArcTan}(\tan (f x)) (-i \cos (2 (e+f x))+\sin (2 (e+f x)))\right )}{16 a^2 f (-i+\tan (e+f x))^2} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(c + d*Tan[e + f*x])^3/(a + I*a*Tan[e + f*x])^2,x]

[Out]

-1/16*(Sec[e + f*x]^2*((4*I)*c^3 + (12*I)*c*d^2 - 8*d^3 + Cos[2*(e + f*x)]*(3*c^2*d*(-1 - (4*I)*f*x) + d^3*(1
+ (4*I)*f*x) + c^3*(I + 4*f*x) - 3*c*d^2*(I + 4*f*x) + 8*d^3*Log[Cos[e + f*x]^2]) + c^3*Sin[2*(e + f*x)] + (3*
I)*c^2*d*Sin[2*(e + f*x)] - 3*c*d^2*Sin[2*(e + f*x)] - I*d^3*Sin[2*(e + f*x)] + (4*I)*c^3*f*x*Sin[2*(e + f*x)]
 + 12*c^2*d*f*x*Sin[2*(e + f*x)] - (12*I)*c*d^2*f*x*Sin[2*(e + f*x)] - 4*d^3*f*x*Sin[2*(e + f*x)] + (8*I)*d^3*
Log[Cos[e + f*x]^2]*Sin[2*(e + f*x)] + 16*d^3*ArcTan[Tan[f*x]]*((-I)*Cos[2*(e + f*x)] + Sin[2*(e + f*x)])))/(a
^2*f*(-I + Tan[e + f*x])^2)

________________________________________________________________________________________

Maple [A]
time = 0.24, size = 159, normalized size = 1.17

method result size
derivativedivides \(\frac {\left (-\frac {1}{8} i c^{3}+\frac {3}{8} i c \,d^{2}-\frac {3}{8} c^{2} d -\frac {7}{8} d^{3}\right ) \ln \left (\tan \left (f x +e \right )-i\right )-\frac {-\frac {3}{2} c^{2} d +\frac {1}{2} d^{3}+\frac {1}{2} i c^{3}-\frac {3}{2} i c \,d^{2}}{2 \left (\tan \left (f x +e \right )-i\right )^{2}}-\frac {\frac {3}{4} i c^{2} d -\frac {5}{4} i d^{3}-\frac {1}{4} c^{3}-\frac {9}{4} c \,d^{2}}{\tan \left (f x +e \right )-i}-\frac {i \left (3 i c^{2} d -i d^{3}-c^{3}+3 c \,d^{2}\right ) \ln \left (\tan \left (f x +e \right )+i\right )}{8}}{f \,a^{2}}\) \(159\)
default \(\frac {\left (-\frac {1}{8} i c^{3}+\frac {3}{8} i c \,d^{2}-\frac {3}{8} c^{2} d -\frac {7}{8} d^{3}\right ) \ln \left (\tan \left (f x +e \right )-i\right )-\frac {-\frac {3}{2} c^{2} d +\frac {1}{2} d^{3}+\frac {1}{2} i c^{3}-\frac {3}{2} i c \,d^{2}}{2 \left (\tan \left (f x +e \right )-i\right )^{2}}-\frac {\frac {3}{4} i c^{2} d -\frac {5}{4} i d^{3}-\frac {1}{4} c^{3}-\frac {9}{4} c \,d^{2}}{\tan \left (f x +e \right )-i}-\frac {i \left (3 i c^{2} d -i d^{3}-c^{3}+3 c \,d^{2}\right ) \ln \left (\tan \left (f x +e \right )+i\right )}{8}}{f \,a^{2}}\) \(159\)
risch \(-\frac {3 i x \,c^{2} d}{4 a^{2}}-\frac {7 i x \,d^{3}}{4 a^{2}}+\frac {c^{3} x}{4 a^{2}}-\frac {3 x c \,d^{2}}{4 a^{2}}-\frac {{\mathrm e}^{-2 i \left (f x +e \right )} d^{3}}{2 a^{2} f}+\frac {i {\mathrm e}^{-2 i \left (f x +e \right )} c^{3}}{4 a^{2} f}+\frac {3 i {\mathrm e}^{-2 i \left (f x +e \right )} c \,d^{2}}{4 a^{2} f}-\frac {3 \,{\mathrm e}^{-4 i \left (f x +e \right )} c^{2} d}{16 a^{2} f}+\frac {{\mathrm e}^{-4 i \left (f x +e \right )} d^{3}}{16 a^{2} f}+\frac {i {\mathrm e}^{-4 i \left (f x +e \right )} c^{3}}{16 a^{2} f}-\frac {3 i {\mathrm e}^{-4 i \left (f x +e \right )} c \,d^{2}}{16 a^{2} f}-\frac {2 i d^{3} e}{a^{2} f}+\frac {d^{3} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}{a^{2} f}\) \(224\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c+d*tan(f*x+e))^3/(a+I*a*tan(f*x+e))^2,x,method=_RETURNVERBOSE)

[Out]

1/f/a^2*((-1/8*I*c^3+3/8*I*c*d^2-3/8*c^2*d-7/8*d^3)*ln(tan(f*x+e)-I)-1/2*(-3/2*c^2*d+1/2*d^3+1/2*I*c^3-3/2*I*c
*d^2)/(tan(f*x+e)-I)^2-(3/4*I*c^2*d-5/4*I*d^3-1/4*c^3-9/4*c*d^2)/(tan(f*x+e)-I)-1/8*I*(3*I*c^2*d-I*d^3-c^3+3*c
*d^2)*ln(tan(f*x+e)+I))

________________________________________________________________________________________

Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: RuntimeError} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))^3/(a+I*a*tan(f*x+e))^2,x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: Error executing code in Maxima: expt: undefined: 0 to a negative e
xponent.

________________________________________________________________________________________

Fricas [A]
time = 1.04, size = 131, normalized size = 0.96 \begin {gather*} \frac {{\left (16 \, d^{3} e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right ) + 4 \, {\left (c^{3} - 3 i \, c^{2} d - 3 \, c d^{2} - 7 i \, d^{3}\right )} f x e^{\left (4 i \, f x + 4 i \, e\right )} + i \, c^{3} - 3 \, c^{2} d - 3 i \, c d^{2} + d^{3} - 4 \, {\left (-i \, c^{3} - 3 i \, c d^{2} + 2 \, d^{3}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} e^{\left (-4 i \, f x - 4 i \, e\right )}}{16 \, a^{2} f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))^3/(a+I*a*tan(f*x+e))^2,x, algorithm="fricas")

[Out]

1/16*(16*d^3*e^(4*I*f*x + 4*I*e)*log(e^(2*I*f*x + 2*I*e) + 1) + 4*(c^3 - 3*I*c^2*d - 3*c*d^2 - 7*I*d^3)*f*x*e^
(4*I*f*x + 4*I*e) + I*c^3 - 3*c^2*d - 3*I*c*d^2 + d^3 - 4*(-I*c^3 - 3*I*c*d^2 + 2*d^3)*e^(2*I*f*x + 2*I*e))*e^
(-4*I*f*x - 4*I*e)/(a^2*f)

________________________________________________________________________________________

Sympy [A]
time = 0.49, size = 393, normalized size = 2.89 \begin {gather*} \begin {cases} \frac {\left (\left (16 i a^{2} c^{3} f e^{4 i e} + 48 i a^{2} c d^{2} f e^{4 i e} - 32 a^{2} d^{3} f e^{4 i e}\right ) e^{- 2 i f x} + \left (4 i a^{2} c^{3} f e^{2 i e} - 12 a^{2} c^{2} d f e^{2 i e} - 12 i a^{2} c d^{2} f e^{2 i e} + 4 a^{2} d^{3} f e^{2 i e}\right ) e^{- 4 i f x}\right ) e^{- 6 i e}}{64 a^{4} f^{2}} & \text {for}\: a^{4} f^{2} e^{6 i e} \neq 0 \\x \left (- \frac {c^{3} - 3 i c^{2} d - 3 c d^{2} - 7 i d^{3}}{4 a^{2}} + \frac {\left (c^{3} e^{4 i e} + 2 c^{3} e^{2 i e} + c^{3} - 3 i c^{2} d e^{4 i e} + 3 i c^{2} d - 3 c d^{2} e^{4 i e} + 6 c d^{2} e^{2 i e} - 3 c d^{2} - 7 i d^{3} e^{4 i e} + 4 i d^{3} e^{2 i e} - i d^{3}\right ) e^{- 4 i e}}{4 a^{2}}\right ) & \text {otherwise} \end {cases} + \frac {d^{3} \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{a^{2} f} + \frac {x \left (c^{3} - 3 i c^{2} d - 3 c d^{2} - 7 i d^{3}\right )}{4 a^{2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))**3/(a+I*a*tan(f*x+e))**2,x)

[Out]

Piecewise((((16*I*a**2*c**3*f*exp(4*I*e) + 48*I*a**2*c*d**2*f*exp(4*I*e) - 32*a**2*d**3*f*exp(4*I*e))*exp(-2*I
*f*x) + (4*I*a**2*c**3*f*exp(2*I*e) - 12*a**2*c**2*d*f*exp(2*I*e) - 12*I*a**2*c*d**2*f*exp(2*I*e) + 4*a**2*d**
3*f*exp(2*I*e))*exp(-4*I*f*x))*exp(-6*I*e)/(64*a**4*f**2), Ne(a**4*f**2*exp(6*I*e), 0)), (x*(-(c**3 - 3*I*c**2
*d - 3*c*d**2 - 7*I*d**3)/(4*a**2) + (c**3*exp(4*I*e) + 2*c**3*exp(2*I*e) + c**3 - 3*I*c**2*d*exp(4*I*e) + 3*I
*c**2*d - 3*c*d**2*exp(4*I*e) + 6*c*d**2*exp(2*I*e) - 3*c*d**2 - 7*I*d**3*exp(4*I*e) + 4*I*d**3*exp(2*I*e) - I
*d**3)*exp(-4*I*e)/(4*a**2)), True)) + d**3*log(exp(2*I*f*x) + exp(-2*I*e))/(a**2*f) + x*(c**3 - 3*I*c**2*d -
3*c*d**2 - 7*I*d**3)/(4*a**2)

________________________________________________________________________________________

Giac [A]
time = 0.82, size = 226, normalized size = 1.66 \begin {gather*} -\frac {\frac {2 \, {\left (-i \, c^{3} - 3 \, c^{2} d + 3 i \, c d^{2} + d^{3}\right )} \log \left (\tan \left (f x + e\right ) + i\right )}{a^{2}} + \frac {2 \, {\left (i \, c^{3} + 3 \, c^{2} d - 3 i \, c d^{2} + 7 \, d^{3}\right )} \log \left (\tan \left (f x + e\right ) - i\right )}{a^{2}} + \frac {-3 i \, c^{3} \tan \left (f x + e\right )^{2} - 9 \, c^{2} d \tan \left (f x + e\right )^{2} + 9 i \, c d^{2} \tan \left (f x + e\right )^{2} - 21 \, d^{3} \tan \left (f x + e\right )^{2} - 10 \, c^{3} \tan \left (f x + e\right ) + 30 i \, c^{2} d \tan \left (f x + e\right ) - 18 \, c d^{2} \tan \left (f x + e\right ) + 22 i \, d^{3} \tan \left (f x + e\right ) + 11 i \, c^{3} + 9 \, c^{2} d + 15 i \, c d^{2} + 5 \, d^{3}}{a^{2} {\left (\tan \left (f x + e\right ) - i\right )}^{2}}}{16 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))^3/(a+I*a*tan(f*x+e))^2,x, algorithm="giac")

[Out]

-1/16*(2*(-I*c^3 - 3*c^2*d + 3*I*c*d^2 + d^3)*log(tan(f*x + e) + I)/a^2 + 2*(I*c^3 + 3*c^2*d - 3*I*c*d^2 + 7*d
^3)*log(tan(f*x + e) - I)/a^2 + (-3*I*c^3*tan(f*x + e)^2 - 9*c^2*d*tan(f*x + e)^2 + 9*I*c*d^2*tan(f*x + e)^2 -
 21*d^3*tan(f*x + e)^2 - 10*c^3*tan(f*x + e) + 30*I*c^2*d*tan(f*x + e) - 18*c*d^2*tan(f*x + e) + 22*I*d^3*tan(
f*x + e) + 11*I*c^3 + 9*c^2*d + 15*I*c*d^2 + 5*d^3)/(a^2*(tan(f*x + e) - I)^2))/f

________________________________________________________________________________________

Mupad [B]
time = 5.66, size = 184, normalized size = 1.35 \begin {gather*} \frac {\mathrm {tan}\left (e+f\,x\right )\,\left (\frac {3\,c^2\,d}{4\,a^2}-\frac {5\,d^3}{4\,a^2}+\frac {c^3\,1{}\mathrm {i}}{4\,a^2}+\frac {c\,d^2\,9{}\mathrm {i}}{4\,a^2}\right )+\frac {c^3}{2\,a^2}+\frac {3\,c\,d^2}{2\,a^2}+\frac {d^3\,1{}\mathrm {i}}{a^2}}{f\,\left ({\mathrm {tan}\left (e+f\,x\right )}^2\,1{}\mathrm {i}+2\,\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (-c^3\,1{}\mathrm {i}-3\,c^2\,d+c\,d^2\,3{}\mathrm {i}+d^3\right )}{8\,a^2\,f}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,\left (c^3\,1{}\mathrm {i}+3\,c^2\,d-c\,d^2\,3{}\mathrm {i}+7\,d^3\right )}{8\,a^2\,f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c + d*tan(e + f*x))^3/(a + a*tan(e + f*x)*1i)^2,x)

[Out]

(tan(e + f*x)*((c^3*1i)/(4*a^2) - (5*d^3)/(4*a^2) + (c*d^2*9i)/(4*a^2) + (3*c^2*d)/(4*a^2)) + c^3/(2*a^2) + (d
^3*1i)/a^2 + (3*c*d^2)/(2*a^2))/(f*(2*tan(e + f*x) + tan(e + f*x)^2*1i - 1i)) - (log(tan(e + f*x) + 1i)*(c*d^2
*3i - 3*c^2*d - c^3*1i + d^3))/(8*a^2*f) - (log(tan(e + f*x) - 1i)*(3*c^2*d - c*d^2*3i + c^3*1i + 7*d^3))/(8*a
^2*f)

________________________________________________________________________________________